package demo1;

import javax.swing.*;
import java.awt.*;
import java.net.URL;

public class rabbit extends JFrame{
    public rabbit() {
        Container container = this.getContentPane();
        URL resource = rabbit.class.getResource("OIP.JPG");
        Icon icon = new ImageIcon(resource);

        JButton button = new JButton();
        button.setIcon(icon);
        button.setToolTipText("红烧兔头");

        container.add(button);

        this.setVisible(true);
        this.setSize(500,300);
        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);//关闭
    }

    public static void main(String[] args){
        new rabbit();
    }
}
